pow.ivyclient
Class Ivy2Udp

java.lang.Object
  extended by pow.ivyclient.Ivy2Udp
All Implemented Interfaces:
java.lang.Runnable

public class Ivy2Udp
extends java.lang.Object
implements java.lang.Runnable

It contact the server to get an identifier, some configuration parameter and the key to encrypt and decrypt messages. Then it listens messages on the ivy bus and send messages on active drones to the web server.

Version:
2.0
Author:
jabln, thomas genin

Constructor Summary
Ivy2Udp(IvyIHM ihm, PowUrl urlObj, java.lang.String login, java.lang.String password)
          create an object which listens on the local ivy bus and send messages to the server
 
Method Summary
 void bindMsg2Ivy()
          This method binds the object to some messages of the bus Ivy.
 int getIvyWebId()
          return the id of the bus for the server this id is provided by the server and is unique
 AcNetIdStorage getStorage()
          provides the structure where data about the drone present on the ivy bus are stored
 void getWebId()
          request a single id for the bus to the web server method get see @link http://hc.apache.org/httpclient-3.x/tutorial.html see @link blogs.sun.com/gc/entry/unable_to_find_valid_certification see @link http://blogs.sun.com/andreas/entry/no_more_unable_to_find
 void run()
          listen the udp socket to get orders from web clients and send them to ivy
 void send(int acId)
          This method send to the web server the datagram containing the informations about the aircraft
 void send(int acId, java.lang.String s)
          This method send a particular message about an aircraft
 void send(int acId, java.lang.String s, java.lang.String[] as)
          This method send to the web server a specific order with parameters
 void setStorage()
          initiate the object which allow to store information about drones
 void startHeartBeat()
          create a thread which send heart beat message to the server
 void stop_thread()
          stop all the thread Ivy2Udp , HeartBeat and ivy2UdpWriting
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Ivy2Udp

public Ivy2Udp(IvyIHM ihm,
               PowUrl urlObj,
               java.lang.String login,
               java.lang.String password)
create an object which listens on the local ivy bus and send messages to the server

Parameters:
urlObj - describes information about the server
login -
password -
Method Detail

setStorage

public void setStorage()
initiate the object which allow to store information about drones


getStorage

public AcNetIdStorage getStorage()
provides the structure where data about the drone present on the ivy bus are stored

Returns:
the structure which allow to store information about drones

getIvyWebId

public int getIvyWebId()
return the id of the bus for the server this id is provided by the server and is unique

Returns:
the unique id of this ivy bus for the server

getWebId

public void getWebId()
              throws IvyConnectionExeption
request a single id for the bus to the web server method get see @link http://hc.apache.org/httpclient-3.x/tutorial.html see @link blogs.sun.com/gc/entry/unable_to_find_valid_certification see @link http://blogs.sun.com/andreas/entry/no_more_unable_to_find

Throws:
IvyConnectionExeption

startHeartBeat

public void startHeartBeat()
create a thread which send heart beat message to the server


bindMsg2Ivy

public void bindMsg2Ivy()
                 throws fr.dgac.ivy.IvyException
This method binds the object to some messages of the bus Ivy. Each information that is needed by the web server is put in an array. This array is sent to server.

Throws:
fr.dgac.ivy.IvyException

stop_thread

public void stop_thread()
stop all the thread Ivy2Udp , HeartBeat and ivy2UdpWriting


send

public void send(int acId)
This method send to the web server the datagram containing the informations about the aircraft

Parameters:
acId - Line of the matrix containing the informations about the plane
Throws:
java.lang.Exception

send

public void send(int acId,
                 java.lang.String s,
                 java.lang.String[] as)
This method send to the web server a specific order with parameters

Parameters:
acId - : Line of the matrix containing the informations about the plane
s - : order
as - : parameters

send

public void send(int acId,
                 java.lang.String s)
This method send a particular message about an aircraft

Parameters:
acId - line of the matrix containing the informations about the plane
s - message that is to be sent to send

run

public void run()
listen the udp socket to get orders from web clients and send them to ivy

Specified by:
run in interface java.lang.Runnable